﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace _0517
{
    public partial class frmCer : Form
    {
        public frmCer()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            /*if ( textBox2.Text == "" || textBox3.Text == "" || textBox4.Text == "" )
            {
                MessageBox.Show("必填项不能为空！");
            }*/
            
            string sex;
            if (radioButton1.Checked)
                sex = "女";
            else
                sex = "男";
            string strSql;
            _0517病例系统.DataAccess data = new _0517病例系统.DataAccess();
            strSql = "insert into Newss(ID,RName,Sex,Phone,Birthday,Yearss,Wheress,Hroty,Xuexing,Wig,Xueyaa,Xueya) values('" + textBox1.Text + "','" + textBox2.Text + "','" + sex + "','" + textBox3.Text + "','" + dateTimePicker1.Value.ToShortDateString() + "','" + textBox8.Text + "','" + textBox4.Text + "','" + richTextBox1.Text + "','" + textBox9.Text + "','" + textBox5.Text + "','" + textBox6.Text + "','" + textBox7.Text + "')";
            data.dataCon();
            if (data.sqlExec(strSql))
            {
                MessageBox.Show("保存成功！");
                
            }
            else
            {
                MessageBox.Show("保存失败！");
            }
            this.Hide();
                frmMain fm = new frmMain();
                fm.Activate();

            
        }

        private void button2_Click(object sender, EventArgs e)
        {
            this.Hide();
        }

        private void dateTimePicker1_ValueChanged(object sender, EventArgs e)
        {
            textBox8.Text = (DateTime.Now.Year - dateTimePicker1.Value.Year).ToString();
            textBox8.Enabled = false;
        }


    }
}
